package bean;

import oracle.ui.pattern.dynamicShell.TabContext;

public class DepartmentBean {
    private String mode = "CONSULTATION";

    public DepartmentBean() {

    }

    public void createDepartment() {
        this.mode = "CREATION";
    }

    public void updateDepartment() {
        this.mode = "EDITION";
    }
    
    public void cancelEditMode() {
        this.mode = "CONSULTATION";
    }

    public void setMode(String mode) {
        this.mode = mode;
    }

    public String getMode() {
        return mode;
    }
    
    private void launchActivity(String title, String taskflowId, boolean newTab) {
        try {
            if (newTab) {
                TabContext.getCurrentInstance().addTab(title, taskflowId);
            } else {
                TabContext.getCurrentInstance().addOrSelectTab(title, taskflowId);
            }
        } catch (TabContext.TabOverflowException toe) {
            // causes a dialog to be displayed to the user saying that there are
            // too many tabs open - the new tab will not be opened...
            toe.handleDefault();
        }
    }
}
